using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using AutoMapper;
using ShopForWeb.Dtos.BasicView;
using ShopForWeb.Models.Basic;

namespace ShopForWeb.Dtos.Profiles
{
  public class ShopProfile : Profile
  {
    public ShopProfile()
    {
      CreateMap<Product, ProductView>()
      .ForMember(dest=>dest.Photo,opt=>opt.MapFrom
      (src => string.IsNullOrEmpty(src.Photo)? "/upload/orange.jpg" : src.Photo))
      .ReverseMap();
      CreateMap<OrderDetails, OrderDetailsView>();
      CreateMap<ShoppingCart, ShoppingCartView>();
      CreateMap<Admin, AdminView>();
      CreateMap<Order, OrderView>();
      CreateMap<User, UserView>();
    }
  }
}
